'gui_chung_dll a program by NGUYEN.Chung (freeware 2012)
#Include Once "windows.bi"

'list of useable procedures
#Define zstringptr Zstring Ptr 
Dim Shared As uint guiwindowdefautflag=WS_SYSMENU or WS_MINIMIZEBOX 'or WS_DLGFRAME 'or WS_MAXIMIZEBOX 

#Inclib "gui_chung_dll"

Declare Sub guireset cdecl alias "guireset" ()

Declare Function guiloadimage cdecl alias "guiloadimage" (byval filename As zstringptr) As hbitmap
          'Supported types; bmp,emf,wmf,jpg,ico,gif
Declare Function guiloadbmp cdecl alias "guiloadbmp" (byval filename As zstringptr) As hbitmap

Declare Function guiloadbmpdib cdecl alias "guiloadbmpdib" (byval filename As zstringptr) As hbitmap

Declare Function guigetbmpdibbits cdecl alias "guigetbmpdibbits" (ByVal hbmp As hbitmap) As Any Ptr  

Declare Sub button cdecl alias "button" (byval controlname As zstringptr,byval controltext As zstringptr,ByVal controlSub As Sub(),_ 
	        ByVal controlx As uint,ByVal controly As uint,ByVal controldx As uint,ByVal controldy As uint,_
	        userflags As uint = 0)
 
Declare Function getguiindex cdecl alias "getguiindex" (byval controlname As zstringptr) As uint 
 
Declare Function getguih cdecl alias "getguih" (byval controlname As zstringptr) As hwnd 

Declare Function getguihname cdecl alias "getguihname" (ByVal guihwin As hwnd) As zstringptr

Declare Sub printguih cdecl alias "printguih" (ByVal hcontrol As hwnd,byval controltext As zstringptr)

Declare Sub printgui cdecl alias "printgui" (byval controlname As zstringptr,byval controltext As zstringptr)

Declare Function guigettexth cdecl alias "guigettexth" (ByVal hcontrol As hwnd) As zstringptr

Declare Function guigettext cdecl alias "guigettext" (byval controlname As zstringptr) As zstringptr 
 
Declare Sub guirefresh Cdecl Alias "guirefresh" 

Declare Sub guirefreshwindow cdecl alias "guirefreshwindow" (byval windowname As zstringptr)

Declare Sub guirefreshcontrolh cdecl alias "guirefreshcontrolh" (ByVal hcontrol As hwnd)

Declare Sub guirefreshcontrol cdecl alias "guirefreshcontrol" (byval controlname As zstringptr)

Declare Sub setedittextfont cdecl alias "setedittextfont" (ByVal fontnum As uint,ByVal size As uint = 0,ByVal italic As Byte = FALSE)
	
Declare Sub setstatictextfont cdecl alias "setstatictextfont" (ByVal fontnum As uint,ByVal size As uint = 0,ByVal italic As Byte = FALSE)

Declare Sub setlistboxfont cdecl alias "setlistboxfont" (ByVal fontnum As uint,ByVal size As uint = 0,ByVal italic As Byte = FALSE)

Declare Sub setbuttonfont cdecl alias "setbuttonfont" (ByVal fontnum As uint,ByVal size As uint = 0,ByVal italic As Byte = FALSE)

Declare Sub guiclosewindow cdecl alias "guiclosewindow" (ByVal windowname As zstringptr)

Declare Sub graphicbox cdecl alias "graphicbox" (byval controlname As zstringptr, _ 
	        ByVal controlx As uint,ByVal controly As uint,ByVal controldx As uint,ByVal controldy As uint,_
	        byval graphtype As zstringptr = @"gfx",ByVal userflags As uint = 0)

Declare Function getguigfxbuffer cdecl alias "getguigfxbuffer" (byval controlname As zstringptr) As Any Ptr

Declare Sub guiscan Cdecl Alias "guiscan"

Declare Sub guiwait Cdecl Alias "guiwait"

Declare Sub guibackgroundcolor cdecl alias "guibackgroundcolor" (r As uint,g As uint,b As uint)

Declare Sub guiedittextbackcolor cdecl alias "guiedittextbackcolor" (r As uint,g As uint,b As uint)

Declare Sub guilistboxbackcolor cdecl alias "guilistboxbackcolor" (r As uint,g As uint,b As uint)

Declare Sub guiedittextinkcolor cdecl alias "guiedittextinkcolor" (r As uint,g As uint,b As uint)

Declare Sub guilistboxinkcolor cdecl alias "guilistboxinkcolor" (r As uint,g As uint,b As uint)

Declare Sub guistatictextinkcolor cdecl alias "guistatictextinkcolor" (r As uint,g As uint,b As uint)

Declare Sub openwindow cdecl alias "openwindow" (ByVal windowname As zstringptr,ByVal windowtext As zstringptr,_ 
                ByVal x As uint,ByVal y As uint,ByVal dx As uint,ByVal dy As uint,_
                ByVal windowtype As uint = guiwindowdefautflag,_
                ByVal windowtypeex As uint = 0)
Declare Sub guiclose cdecl alias "guiclose" (ByVal opt As zstringptr = @"nomsg")

Declare Sub guiquit cdecl alias "guiquit" (ByVal opt As zstringptr = @"nomsg")

Declare Sub trapclose cdecl alias "trapclose" (ByVal windowname As zstringptr,ByVal closesub As Sub())	

Declare Sub trapresize cdecl alias "trapresize" (byval windowname As zstringptr,ByVal resizesub As Sub())	

Declare Sub trapkeyboard cdecl alias "trapkeyboard" (byval windowname As zstringptr,ByVal keyboardsub As Sub())	

Declare Sub trapLeftmouse cdecl alias "trapLeftmouse" (byval controlname As zstringptr,ByVal mousesub As Sub())	

Declare Sub trapRightmouse cdecl alias "trapRightmouse" (byval controlname As zstringptr,ByVal mousesub As Sub())	

Declare Sub trapLeftmouseup cdecl alias "trapLeftmouseup" (byval controlname As zstringptr,ByVal mousesub As Sub())	

Declare Sub trapRightmouseup cdecl alias "trapRightmouseup" (byval controlname As zstringptr,ByVal mousesub As Sub())	

Declare Sub trapmovemouse cdecl alias "trapmovemouse" (byval controlname As zstringptr,ByVal mousesub As Sub())	

Declare Sub enableguih cdecl alias "enableguih" (ByVal hcontrol As hwnd)

Declare Sub disableguih cdecl alias "disableguih" (ByVal hcontrol As hwnd)

Declare Sub enablegui cdecl alias "enablegui" (byval controlname As zstringptr)

Declare Sub disablegui cdecl alias "disablegui" (byval controlname As zstringptr)

Declare Sub showguih cdecl alias "showguih" (ByVal hcontrol As hwnd)

Declare Sub hideguih cdecl alias "hideguih" (ByVal hcontrol As hwnd)

Declare Sub showgui cdecl alias "showgui" (byval controlname As zstringptr)

Declare Sub hidegui cdecl alias "hidegui" (byval controlname As zstringptr)

Declare Sub radiobutton cdecl alias "radiobutton" (byval controlname As zstringptr,byval controltext As zstringptr,ByVal controlsub As Sub(),_ 
	        ByVal controlx As uint,ByVal controly As uint,ByVal controldx As uint,ByVal controldy As uint)
 
Declare Sub checkbox cdecl alias "checkbox" (byval controlname As zstringptr,byval controltext As zstringptr,ByVal controlsub As Sub(),_ 
	        ByVal controlx As uint,ByVal controly As uint,ByVal controldx As uint,ByVal controldy As uint)
 
Declare Sub iconbutton cdecl alias "iconbutton" (byval controlname As zstringptr,byval iconfile As zstringptr,ByVal controlsub As Sub(),_ 
	        ByVal controlx As uint,ByVal controly As uint,ByVal controldx As uint,ByVal controldy As uint)
 
Declare Sub bmpbutton cdecl alias "bmpbutton" (byval controlname As zstringptr,byval bmpfile As zstringptr,ByVal controlsub As Sub(),_ 
	        ByVal controlx As uint,ByVal controly As uint,ByVal controldx As uint,ByVal controldy As uint)

Declare Sub staticicon cdecl alias "staticicon" (byval controlname As zstringptr,byval iconfile As zstringptr,_ 
	        ByVal controlx As uint,ByVal controly As uint,ByVal controldx As uint,ByVal controldy As uint)

Declare Sub staticbmp cdecl alias "staticbmp" (byval controlname As zstringptr,byval bmpfile As zstringptr,_ 
	        ByVal controlx As uint,ByVal controly As uint,ByVal controldx As uint,ByVal controldy As uint)

Declare Sub statictext cdecl alias "statictext" (byval controlname As zstringptr,byval controltext As zstringptr,_ 
	        ByVal controlx As uint,ByVal controly As uint,ByVal controldx As uint,ByVal controldy As uint,_
	        userflags As uint = 0)
 
Declare Sub edittext cdecl alias "edittext" (byval controlname As zstringptr,byval controltext As zstringptr,ByVal controlsub As Sub(),_ 
	        ByVal controlx As uint,ByVal controly As uint,ByVal controldx As uint,ByVal controldy As uint,_
	        userflags As uint = 0)

Declare Sub combobox cdecl alias "combobox" (ByVal controlname As zstringptr,ByVal controlsub As Sub(),_ 
	        ByVal controlx As uint,ByVal controly As uint,ByVal controldx As uint,ByVal controldy As uint)

Declare Sub reloadcombo cdecl alias "reloadcombo" (ByVal comboname As zstringptr,byval liste as zstringptr ptr)
 
Declare Sub addcombo cdecl alias "addcombo" (byval comboname As zstringptr,ByVal liste As zstringptr)
 
Declare Sub selectcombotext cdecl alias "selectcombotext" (byval comboname As zstringptr,ByVal item As zstringptr,byval liste as zstringptr Ptr)
 
Declare Sub selectcomboindex cdecl alias "selectcomboindex" (ByVal comboname As zstringptr,ByVal i As uint)
 
Declare Sub getcomboindex cdecl alias "getcomboindex" (byval comboname As zstringptr,Byval i As uint ptr)
 
Declare Sub removecombo cdecl alias "removecombo" (ByVal comboname As zstringptr,ByVal i As uint)
 
Declare Sub resetcombo cdecl alias "resetcombo" (ByVal comboname As zstringptr)

Declare Function getcombotext cdecl alias "getcombotext" (ByVal comboname As zstringptr,byval liste as zstringptr Ptr) As zstringptr

Declare Sub setcheckbox cdecl alias "setcheckbox" (byval checkname As zstringptr)
 
Declare Sub unsetcheckbox cdecl alias "unsetcheckbox" (byval checkname As zstringptr)

Declare Sub listbox cdecl alias "listbox" (byval controlname As zstringptr,ByVal controlsub As Sub(),_ 
	        ByVal controlx As uint,ByVal controly As uint,ByVal controldx As uint,ByVal controldy As uint,_ 
	        userflags As uint = 0)

Declare Sub reloadlistbox cdecl alias "reloadlistbox" (byval listboxname As zstringptr,byval liste as zstringptr Ptr)
 
Declare Sub selectlistboxtext cdecl alias "selectlistboxtext" (byval listboxname As zstringptr,byval item As zstringptr,byval liste as zstringptr ptr)
 
Declare Sub addlistbox cdecl alias "addlistbox" (byval listboxname As zstringptr,byval text As zstringptr)

Declare Function getlistboxtextbyindex cdecl alias "getlistboxtextbyindex" (byval listboxname As zstringptr,ByVal index As uint) As zstringptr
 
Declare Sub getlistboxindex cdecl alias "getlistboxindex" (byval listboxname As zstringptr,Byval i As uint ptr)
 
Declare Sub selectlistboxindex cdecl alias "selectlistboxindex" (byval listboxname As zstringptr,ByVal i As uint)
 
Declare Function getlistboxtext cdecl alias "getlistboxtext" (byval listboxname As zstringptr) As zstringptr

Declare Function guiiswindowopen cdecl alias "guiiswindowopen" (byval windowname As zstringptr) As UInteger

Declare Function guiisopen cdecl alias "guiisopen" (byval windowname As zstringptr) As UInteger

Declare Sub guigetwindowpos cdecl alias "guigetwindowpos" (byval windowname As zstringptr,byval x As uint ptr,Byval y As uint ptr,_ 
	                 Byval dx As uint ptr,Byval dy As uint ptr)

Declare Sub guimovewindow cdecl alias "guimovewindow" (byval windowname As zstringptr,ByVal x As uint,ByVal y As uint,_ 
	               ByVal dx As uint,ByVal dy As uint)

Declare Sub guimovecontrol cdecl alias "guimovecontrol" (byval controlname As zstringptr,ByVal x As uint,ByVal y As uint,_ 
	               ByVal dx As uint = 0,ByVal dy As uint = 0)

Declare Sub guishowwindow cdecl alias "guishowwindow" (byval windowname As zstringptr)

Declare Sub guisetfocus cdecl alias "guisetfocus" (byval windowname As zstringptr)

Declare Sub addusersub cdecl alias "addusersub" (ByVal i As uint,usersub As Sub() )

Declare Sub changeusersub cdecl alias "changeusersub" (ByVal i As uint,usersub As Sub())

Declare Sub addmenu cdecl alias "addmenu" (byval controlname As zstringptr,byval controltext As zstringptr,_
	           ByVal controlflag As uint = MF_string Or MF_POPUP) 

Declare Sub addmenuitem cdecl alias "addmenuitem" (byval controlname As zstringptr,byval controltext As zstringptr,ByVal controlsub As Sub(),_
	             ByVal controlflag As uint = MF_string) 

Declare Sub setcheckmenu cdecl alias "setcheckmenu" (byval menuname As zstringptr,ByVal i As uint)

Declare Sub uncheckmenu cdecl alias "uncheckmenu" (byval menuname As zstringptr,ByVal i As uint)

Declare Sub enablemenu cdecl alias "enablemenu" (byval menuname As zstringptr,ByVal i As uint)

Declare Sub disablemenu cdecl alias "disablemenu" (byval menuname As zstringptr,ByVal i As uint)

Declare Sub setmenutext cdecl alias "setmenutext" (byval menuname As zstringptr,ByVal i As uint,byval text As zstringptr)

Declare Function guitestkey cdecl alias "guitestkey" (ByVal ikey As uint) As Integer

'Declare Function guiword cdecl alias "guiword" (byval t As zstringptr,ByVal i As uint,byval s As zstringptr) As zstringptr

Declare Function filedialog cdecl alias "filedialog" (byval titre As zstringptr,byval filtre As zstringptr = @"") As zstringptr

Declare Sub guigltext cdecl alias "guigltext" (byval text As zstringptr)

Declare Sub guistartOpenGL cdecl alias "guistartOpenGL" (byval controlname As zstringptr) 'start opengl , only one at a time

Declare Sub guicloseOpenGL Cdecl Alias "guicloseOpenGL" 'close and purge opengl

Declare Sub guirefreshopenGL Cdecl Alias "guirefreshopenGL"

Declare Function guicreateDIBbmp cdecl alias "guicreateDIBbmp" (ByVal x As uint,ByVal y As uint) As hbitmap

Declare Function guiloadtexture cdecl alias "guiloadtexture" (byval filename As zstringptr,ByVal maxcolor As uint=255, ByVal alph As uint=127) As uint 'bmp jpg gif ico

Declare Sub guideletetexture cdecl alias "guideletetexture" (ByVal itexture As uint)

Declare Function guicurrentcontrolname cdecl alias "guicurrentcontrolname" () As zstringptr

Declare Sub guigetbmpXY cdecl alias "guigetbmpXY" (ByVal bmpdc As hdc,ByVal bmpx As uint Ptr,ByVal bmpy As uint Ptr) 

Declare Sub guidrawcolor Cdecl Alias "guidrawcolor" (ByVal r As uint,ByVal g As uint,_  
	                         ByVal b As uint,ByVal a As uint)
Declare Sub guidrawbackcolor Cdecl Alias "guidrawbackcolor" (ByVal r As uint,ByVal g As uint,_  
	                         ByVal b As uint,ByVal a As uint) 
Declare Sub guidrawstringbuffer Cdecl Alias "guidrawstringbuffer" (ByVal buffer As Any Ptr,_ 
	            ByVal x As integer,ByVal y As Integer,ByVal text As zstringptr) 
Declare Sub guidrawstring Cdecl Alias "guidrawstring" (ByVal wingraph As zstringptr,_ 
	            ByVal x As integer,ByVal y As Integer,ByVal text As zstringptr) 
Declare Sub guidrawcmdbuffer Cdecl Alias "guidrawcmdbuffer" (ByVal buffer As Any Ptr,_ 
	            ByVal cmd As zstringptr)
Declare Sub guidrawcmd Cdecl Alias "guidrawcmd" (ByVal wingraph As zstringptr,_ 
	            ByVal cmd As zstringptr)
Declare Sub guidrawlinebuffer Cdecl Alias "guidrawlinebuffer" (ByVal buffer As Any Ptr,_ 
	            ByVal x1 As integer,ByVal y1 As Integer, _  
	            ByVal x2 As integer,ByVal y2 As Integer)
Declare Sub guidrawline Cdecl Alias "guidrawline" (ByVal wingraph As zstringptr,_ 
	            ByVal x1 As integer,ByVal y1 As Integer, _  
	            ByVal x2 As integer,ByVal y2 As Integer) 
Declare Sub guidrawboxbuffer Cdecl Alias "guidrawboxbuffer" (ByVal buffer As Any Ptr,_ 
	            ByVal x1 As integer,ByVal y1 As Integer, _  
	            ByVal x2 As integer,ByVal y2 As Integer,ByVal fill As uint=0)
Declare Sub guidrawbox Cdecl Alias "guidrawbox" (ByVal wingraph As zstringptr,_ 
	            ByVal x1 As integer,ByVal y1 As Integer, _  
	            ByVal x2 As integer,ByVal y2 As Integer,ByVal fill As uint=0) 
Declare Sub guidrawcirclebuffer Cdecl Alias "guidrawcirclebuffer" (ByVal buffer As Any Ptr,_ 
	            ByVal x As integer,ByVal y As Integer, _  
	            ByVal r As uint,ByVal fill As uint=0)
Declare Sub guidrawcircle Cdecl Alias "guidrawcircle" (ByVal wingraph As zstringptr,_ 
	            ByVal x As integer,ByVal y As Integer, _  
	            ByVal r As uint,ByVal fill As uint=0)
Declare Sub guidrawpointbuffer Cdecl Alias "guidrawpointbuffer" (ByVal buffer As Any Ptr,_ 
	            ByVal x As integer,ByVal y As Integer)
Declare Sub guidrawpoint Cdecl Alias "guidrawpoint" (ByVal wingraph As zstringptr,_ 
	            ByVal x As integer,ByVal y As Integer)
